var t, a = getApp(), e = a.globalData.url, n = require("../../../utils/util.js");

Page({
    data: {
        image: [ "http://imgsrc.baidu.com/image/c0%3Dpixel_huitu%2C0%2C0%2C294%2C40/sign=82be08cdbc4543a9e116f28c776fefee/b999a9014c086e062c32e97209087bf40ad1cb75.jpg", "http://pic15.photophoto.cn/20100406/0038038032489808_b.jpg", "http://pic23.nipic.com/20120803/9171548_144243306196_2.jpg" ],
        evaluateList: [],
        evaluateLength: 0,
        pageNum: 1,
        domain: e
    },
    onLoad: function(a) {
        t = this, void 0 !== a.id && null != a.id && t.setData({
            shopId: a.id
        }), t.getEvaluate();
    },
    onReady: function() {},
    onShow: function() {},
    clickImg: function(t) {
        var a = t.currentTarget.dataset.url;
        wx.previewImage({
            current: a,
            urls: [ a ]
        });
    },
    getEvaluate: function(e) {
        var o = a.globalData.token, u = t.data.pageNum;
        n.request(a, "wx/cust/getEvaluateNum", "GET", {
            shopId: t.data.shopId,
            token: o
        }, function(a) {
            a.state && t.setData({
                evaluateNum: a.data
            });
        }, function(t) {}), n.request(a, "wx/cust/getEvaluateInfo", "GET", {
            shopId: t.data.shopId,
            page: u,
            rows: 10,
            token: o
        }, function(a) {
            var n = a.data;
            n.forEach(function(t) {
                return t.evalContent = decodeURIComponent(t.evalContent);
            }), t.setData({
                evaluateList: e ? n : t.data.evaluateList.concat(n),
                evaluateLength: a.data.length
            });
        }, function(t) {});
    },
    onReachBottom: function() {
        t.setData({
            pageNum: t.data.pageNum + 1
        }), t.getEvaluate();
    },
    onPullDownRefresh: function() {
        t.setData({
            pageNum: 1
        }), t.getEvaluate(!0), wx.showNavigationBarLoading(), setTimeout(function() {
            wx.hideNavigationBarLoading(), wx.stopPullDownRefresh();
        }, 1500);
    }
});